<template>
  <el-pagination
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
    :current-page="page"
    :page-sizes="[2,5, 10, 20, 30]"
    :page-size="pagesize"
    :hide-on-single-page="true"
    :background="true"
    :total="totalNum"
    layout=" prev, pager, next,sizes, jumper"
  >
  </el-pagination>
</template>
<script>
export default {
  props: {
    page: {
      type: Number,
      default: 1
    },
    pagesize: {
      type: Number,
      default: 10
    },
    totalNum: {
      type: Number,
      default: 10
    }
  },
  methods: {
    handleSizeChange (val) {
      console.log('当前页是:' + this.page, '每页条数:' + val)
      this.$emit('changeFenYe', {
        page: this.page,
        pagesize: val
      })
    },
    handleCurrentChange (val) {
      console.log('当前页是:' + val, '每页条数:' + this.pagesize)
      this.$emit('changeFenYe', {
        page: val,
        pagesize: this.pagesize
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.el-pagination{
  text-align: right;
}
</style>
